package ssii.camino;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SimpleAdapter;
import android.widget.TextView;

public class CustomAdapter extends SimpleAdapter{
	private ArrayList<Comercio> listaComercios;
	public CustomAdapter(Context context, ArrayList<Map<String,String>> data,
			int resource, String[] from, int[] to) {
		super(context, data, resource, from, to);
		// TODO Auto-generated constructor stub
	}
	
	public void setComercios(ArrayList<Comercio> l){
	listaComercios = l;
	}
	@Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View v = super.getView(position, convertView, parent);
        if (listaComercios.get(position).getVotado()) {
             v.setBackgroundColor(Color.GRAY); 
        }else{
        	v.setBackgroundColor(Color.BLACK);
        }
        return v;
    }
}
